<?php
class CourseRecordServer {
	public function add($data){
		$data['add_time'] = time();
		$bookData = HttpDaoManager::getBookCourseDao()->get($data['book_course_id']);
		$data['user_id'] = $bookData['user_id'];
		$data['teacher_id'] = $bookData['teacher_id'];
		HttpDaoManager::getCourseRecordDao()->add($data);
		
		if(isset($data['user_level'])&&$data['user_level']>0){
			$userData = array();
			$userData['level'] = $data['user_level'];
			$user_id = $bookData['user_id'];
			
			HttpDaoManager::getUserDao()->update($userData,$user_id);
		}
	}
}
?>